package com.book.service.impl;

import com.book.bean.Book;
import com.book.dao.BookDao;
import com.book.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookServiceImpl implements BookService {
    //spring的注入标签，该标签的作用实例化CategoryDao对象

    @Autowired
    private BookDao bookDao;

    public List<Book> listPager(int page , int size, String bname) {
        return bookDao.listPager((page-1)*size,size,bname);
    }

    public int count(){
        return bookDao.count();
    }

    @Override
    public boolean removeBook(int bid) {
        return bookDao.delete(bid) > 0;
    }
}
